<?php
session_start();
include("load-settings.php");

if(!isset($_SESSION['user']))
	header("Location: login.php");

$user = mysql_real_escape_string($_SESSION['user']);
$result = mysql_query("SELECT * FROM user WHERE id = $user");
$row = mysql_fetch_array($result);

if($row['type'] != 2)
	header("Location: home.php");

$message = mysql_real_escape_string($_POST['message']);
$name = mysql_real_escape_string($_POST['name']);

mysql_query("INSERT INTO email_notification (name, message) VALUES ('$name', '$message')") or die(mysql_error());

header("Location: email_notifications.php");

?>